<?php

namespace App\models\forum;

use Illuminate\Database\Eloquent\Model;

/**
 * App\models\forum\PartitionCategorie
 *
 * @property int $id
 * @property int $pid
 * @property int $cid
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\models\forum\Categorie[] $categorie
 * @method static \Illuminate\Database\Query\Builder|\App\models\forum\PartitionCategorie whereId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\models\forum\PartitionCategorie wherePid($value)
 * @method static \Illuminate\Database\Query\Builder|\App\models\forum\PartitionCategorie whereCid($value)
 * @mixin \Eloquent
 * @property \Carbon\Carbon $updated_at
 * @property \Carbon\Carbon $created_at
 * @method static \Illuminate\Database\Query\Builder|\App\models\forum\PartitionCategorie whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\models\forum\PartitionCategorie whereCreatedAt($value)
 */
class PartitionCategorie extends Model
{
    public function categorie(){
        return $this->belongsTo(Categorie::class, 'cid', 'id');
    }

    public static function isHas($pid, $cid)
    {
        $hs = self::where('pid', $pid)->where('cid', $cid)->first();
        return empty($hs) == true ? false : true;
    }
}
